﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Hanel.DTN.News;
using DTN.Core;
using System.Data;

public partial class Control_Home_TinNoiBat : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
           

    }
    public string BindData()
    {
        string data = string.Empty;
        try
        {
            ItblContentManager obj = tblContentManager.CreateInstance();
            ItblCommentManager objcom = tblCommentManager.CreateInstance();
            DataTable dt = obj.SelecttblContentDynamic_top("Top 6", "Status=1 and orderNews!=0", "orderNews");
            data += "<ol class=\"subNav\">";
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow dr = dt.Rows[i];
                DataTable ds = objcom.SelecttblCommentDynamic("active=1 and content_ID=" + dr["id"], "com_create");
                data += "<li><a class = \"slide_" + (i + 1) + "\" href=\"javascript:void(0);\">&nbsp;</a>";
                data += "<div class=\"slideContent\">";
                data += "<a href=\"News.aspx?ID=" + dr["ID"] + "\" class=\"mainArtLink\">";
                data += "<img alt=\"" + dr["Title"] + "\" title=\"" + dr["Title"] + "\" src=\"" + dr["LinkImage"] + "\" width=\"100\"/>";
                data += "</a>";
                data += "<h1 class=\"title\"><a href=\"News.aspx?ID=" + dr["ID"] + "\">" + dr["Title"] + "</a>";
                data += "</h1>";
                data += "<p class=\"deck\">" + ToolCatChuoi.GetShortReview(dr["Header"].ToString(), 40) + "</p>";
                data += "<p class=\"deckShort\">" + ToolCatChuoi.GetShortReview(dr["Header"].ToString(), 40) + "</p>";
                data += "<p class=\"date\">" + Utils.GetTime(DateTime.Parse(dr["Ngay"].ToString())) + "</p>";
                data += "<p class=\"comment\">" + ds.Rows.Count.ToString() + " phản hồi</p>";
                data += "</div>";
                data += "</li>";
               
            }
            data += "</ol>";
            
            data += "<div class=\"lightBox\">";
            data += " <a href=\"javascript:void(0);\">&nbsp;</a></div>";
            data += "<div class=\"comments\">";              
            data += "0 phản hồi";              
            data += "</div>";
           
        }
        catch
        {
            return data;
        }
        return data;
    }
}